<script setup>
import { appStockListQuery } from "@/services/cashier";
import { onLoad, onReady, onShow } from "@dcloudio/uni-app";
import { nextTick, ref, watch, onMounted } from "vue";
import { appInfo, loginSwitch } from "@/services/user";

onLoad((e) => {});
onReady(() => {
  // 微信小程序需要用此写法
  // datetimePickerRef.value.setFormatter(formatter);
});

// 定义 open 方法
const open = (e) => {
  // console.log('open', e)
};

// 定义 close 方法
const close = (e) => {
  // console.log('close', e)
};

// 定义 change 方法
const change = (e) => {
  // console.log('change', e)
};
const showtime = ref(false);
const datetimePickerRef = ref(null);
const timevalue = ref(Time(Date.now()));
function Time(e) {
  const date = new Date(e);
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始，需要加1
  const day = String(date.getDate()).padStart(2, "0");
  return `${year}-${month}-${day}`;
}
const confirmDate = (E) => {
  timevalue.value = Time(E.value);
  showtime.value = false;
};

const show = ref(false);
const value1 = ref(Date.now());

// const formatter = (type, value) => {
//   if (type === "year") {
//     return `${value}年`;
//   }
//   if (type === "month") {
//     return `${value}月`;
//   }
//   if (type === "day") {
//     return `${value}日`;
//   }
//   return value;
// };

const gopagesfun = (e) => {
  uni.navigateTo({
    url: "/pages/cashier/statistics/index",
  });
};
</script>

<template>
  <view class="bg">
    <up-navbar
      bgColor="rgba(255, 255, 255, 1)"
      @rightClick="rightClick"
      :autoBack="true"
      :safeAreaInsetTop="true"
      :fixed="true"
      :placeholder="true"
      :leftText="'返回'"
    >
      <template #right> </template>
      <template #center>
        <text
          class="text-white"
          style="
            font-weight: 500;
            font-size: 34rpx;
            color: #000000;
            line-height: 48rpx;
            text-align: center;
          "
          >员工管理</text
        ></template
      >
    </up-navbar>

    <view class="top">
      <view class="top-search">
        <up-search
          placeholder="日照香炉生紫烟"
          v-model="keyword"
          :showAction="false"
        ></up-search>
      </view>
    </view>
    <view class="content"> </view>
  </view>

  <up-datetime-picker
    class="top-center"
    :hasInput="false"
    @close="showtime = false"
    @confirm="confirmDate"
    @cancel="showtime = false"
    format="YYYY-MM-DD"
    :show="showtime"
    v-model="timevalue"
    :closeOnClickOverlay="true"
    mode="date"
  >
  </up-datetime-picker>
</template>

<style lang="scss" scoped>
@import "index.scss";
</style>
